<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CouponSchedulePostRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'cid' => 'required|integer', // 优惠券ID
            'start_time' => 'required', // 优惠券领取开启时间
            'end_time' => 'required', //优惠券领取结束时间
            'total_count' => 'required|integer', //优惠券领取数量
            'is_permanent' => 'required', //是否无限张数
            'status' => 'required', //状态
            'is_give_subscribe' => 'required', //是否首次关注赠送
            'is_full_give' => 'required', //是否满赠
            'full_reduction' => 'required', //消费满多少赠送优惠券
        ];
    }

    /**
     * 获取已定义验证规则的错误消息。
     *
     * @return array
     */
    public function messages()
    {
        return [
            'cid.required' => '优惠券必选',
            'cid.integer' => '优惠券参数错误',
            'start_time.required' => '优惠券开启时间必选',
            'end_time.required' => '优惠券结束时间必选',
            'total_count.required' => '优惠券数量必填',
            'total_count.integer' => '优惠券数量为整数',
            'is_permanent.required' => '是否无限张数必选',
            'status.required' => '状态必选',
            'is_give_subscribe.required' => '是否首次关注赠送必选',
            'is_full_give.required' => '是否满赠必选',
            'full_reduction.required' => '消费满多少赠送优惠券必填',
        ];
    }
}
